using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerState_TopJump : PlayerState_TopBase
{
    public PlayerState_TopJump(StateMachine stateMachine, Player player, string animName) : base(stateMachine, player, animName)
    {

    }
    public override void OnEnter()
    {
        base.OnEnter();
        player.SetVelocity(rb.velocity.x, 0);
        player.SetVelocity(rb.velocity.x, player._topJumpForce);
    }
    public override void OnFixedUpdate()
    {
        base.OnFixedUpdate();
        player.SetVelocity(player.MoveInput.x * player._topmoveSpeed, rb.velocity.y);
        
        if (rb.velocity.y < 0)
            stateMachine.SwitchState(player.PlayerTopFallState);

        player.SetVelocity(player._topmoveSpeed * player.MoveInput.x, rb.velocity.y);
    }
}
